<!--
  Copyright JS Foundation and other contributors, http://js.foundation

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<script type="text/html" data-help-name="sort">
    <p>A function that sorts message property or a sequence of messages.</p>
    <p>When configured to sort message property, the node sorts array data pointed to by specified message property.</p>
    <p>When configured to sort a sequence of messages, it will reorder the messages.</p>
    <p>The sorting order can be:</p>
    <ul>
        <li><b>ascending</b>,</li>
        <li><b>descending</b>.</li>
    </ul>
    <p>For numbers, numerical ordering can be specified by a checkbox.</p>
    <p>Sort key can be element value or JSONata expression for sorting property value, or message property or JSONata expression for sorting a message sequence.<p>
    <p>When sorting a message sequence, the sort node relies on the received messages to have <code>msg.parts</code> set.  The split node generates this property, but can be manually created.  It has the following properties:</p>
    <p>
        <ul>
            <li><code>id</code> - an identifier for the group of messages</li>
            <li><code>index</code> - the position within the group</li>
            <li><code>count</code> - the total number of messages in the group</li>
        </ul>
    </p>
    <p><b>Note:</b> This node internally keeps messages for its operation.  In order to prevent unexpected memory usage, maximum number of messages kept can be specified.  Default is no limit on number of messages.
        <ul>
            <li><code>nodeMessageBufferMaxLength</code> property set in <b>settings.js</b>.</li>
        </ul>
    </p>
</script>
